package xc.com.oss.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import xc.com.oss.service.FileService;

import java.util.Map;

/**
 * @Description TODO
 * @Author yc
 * @Date 2021/5/28 11:32
 **/
@RestController
@CrossOrigin
@RequestMapping("file")
public class FileController {

    @Autowired
    private FileService fileService;

    @PostMapping("/upload")
    public String upload(MultipartFile file) {
        return fileService.upload(file);
    }
    @PostMapping("/uploadMedia")
    public Map<String, Object> uploadMedia(MultipartFile file) {
        return fileService.uploadMedia(file);
    }
    @DeleteMapping("/delete")
    public boolean delete(@RequestBody String fileName) {
        return fileService.delete(fileName);
    }
}
